<!DOCTYPE html>
<html lang="zh-CN">
<head>
    //@ include("/inc/head.html"){}
    <title>Session列表</title>

    <script>
        function del(id) {
            swal({
                    title: "您确定要踢出当前用户？",
                    text: "踢出后用户需要重新登录，请确认后踢出！",
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#DD6B55",
                    confirmButtonText: "踢出",
                    cancelButtonText: "保留",
                    closeOnConfirm: false,
                    closeOnCancel: false,
                    showLoaderOnConfirm: true
                },
                function (isConfirm) {
                    if (isConfirm) {
                        location.href = '${ctxPath}/shiro/session/clear/' + id;
                        swal("提示", "踢出成功！", "success");
                    } else {
                        swal("提示", "用户未被踢出！", "info");
                    }
                });
        }
    </script>
</head>
<body>

//@ include("/shiro/top.html"){}

<div class="container-fluid">
    <ol class="breadcrumb">
        <li><a href="${ctxPath}/shiro/main">权限管理</a></li>
        <li class="active">Session管理(${shiroSessions.total})</li>
    </ol>

    //@ if(isNotEmpty(errMsg)){
    <div class="alert alert-danger" role="alert">${errMsg!}</div>
    //@ }

    <div class="table-responsive">
        <table data-toggle="table" data-show-columns="true">
            <thead>
            <tr>
                <th>#</th>
                <th>SessionID</th>
                <th>HOST</th>
                <th data-visible="false">Session超时时间(毫秒)</th>
                <th>Session启动时间</th>
                <th>Session最后活动时间</th>
                <th data-visible="false">Session属性内容</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            //@ for(shiroSession in shiroSessions.shiroSessionList){
            <tr>
                <td>${shiroSessionLP.index}</td>
                <td>${shiroSession.sessionId}</td>
                <td>${shiroSession.host}</td>
                <td>${shiroSession.timeout}</td>
                <td>${shiroSession.startTimestamp,dateFormat='yyyy-MM-dd HH:mm:ss'}</td>
                <td>${shiroSession.lastAccessTime,dateFormat='yyyy-MM-dd HH:mm:ss'}</td>
                <td>${shiroSession.attributesJson}</td>
                <td>
                    //@ if(shiroSessions.currentSessionId != shiroSession.sessionId){
                    <button class="btn btn-danger" onclick="del('${shiroSession.sessionId}');">踢出</button>
                    //@ }
                </td>
            </tr>
            //@ }
            </tbody>
        </table>
    </div>

</div>
</body>
</html>